package org.example;

import java.util.ArrayList;
import java.util.List;

public class Student extends Person {
    private List<Course> selectedCourses = new ArrayList<>();

    public Student() {
        super();
    }

    public Student(String studentId, String studentName, String gender) {
        super(studentId, studentName, gender);
    }

    public void selectCourse(Course course) {
        selectedCourses.add(course);
        System.out.println(name + " 选了课程：" + course.getCourseName());
    }

    public void dropCourse(Course course) {
        if (selectedCourses.remove(course)) {
            System.out.println(name + " 退了课程：" + course.getCourseName());
        } else {
            System.out.println(name + " 未选该课程，无法退课");
        }
    }

    public void printWorkOrder() {
        super.printWorkOrder();
        System.out.println(name + " 的课表：");
        for (Course course : selectedCourses) {
            System.out.println(course);
        }
        System.out.println("------------------------");
    }

    public List<Course> getSelectedCourses() {
        return selectedCourses;
    }

    public void setSelectedCourses(List<Course> selectedCourses) {
        this.selectedCourses = selectedCourses;
    }
}